package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.ReplyDTO;
import com.tianji.learning.domain.query.ReplyPageQuery;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 管理端互动问题的回答或评论 前端控制器
 * </p>
 *
 * @author yb0os1
 * @since 2024-12-25
 */
@Api(tags = "管理端回答或评论的相关接口")
@RestController
@RequestMapping("/admin/replies")
@RequiredArgsConstructor
public class AdminInteractionReplyController {
    private final IInteractionReplyService interactionReplyService;

    @ApiOperation("管理端分页查询回答和评论列表")
    @GetMapping("/page")
    public PageDTO<ReplyVO> queryReplyPage(ReplyPageQuery query){
        return interactionReplyService.queryReplyPageByAdmin(query);
    }

    @ApiOperation("管理端隐藏或显示回答和评论列表")
    @PutMapping("/{id}/hidden/{hidden}")
    public void updateHiddenStatus(@PathVariable Long id, @PathVariable Boolean hidden) {
        interactionReplyService.updateStatus(id, hidden);
    }
}
